package com.scvtc.controller.party;

import com.scvtc.domain.ResResult;
import com.scvtc.domain.entity.party.PartyDocumention;
import com.scvtc.domain.vo.PageVo;
import com.scvtc.service.party.PartyDocumentionervice;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "党员材料(PartyDocumentionController)")
@RestController
@RequestMapping("partyDocumention")
public class PartyDocumentionController {

    @Autowired
    PartyDocumentionervice partyDocumentionervice;

    @GetMapping("/list")
    @ApiOperation("查询所有材料")
    public ResResult<PageVo<List<PartyDocumention>>> getAllTeacherSocialService(
            @RequestParam(defaultValue = "1") Long current,
            @RequestParam(defaultValue = "10") Long size,
            PartyDocumention partyDocumention) {
        return partyDocumentionervice.getAllInfo(current, size, partyDocumention);
    }

    @PostMapping("/")
    @ApiOperation("添加材料")
    public ResResult<?> addDocument(@RequestBody PartyDocumention documention) {
        return partyDocumentionervice.addDocument(documention);
    }


    @PutMapping("/")
    @ApiOperation("修改材料")
    public ResResult<?> updateDocument(@RequestBody PartyDocumention documention) {
        return partyDocumentionervice.updateDocument(documention);
    }

    @DeleteMapping("/")
    @ApiOperation("删除一条材料信息")
    public ResResult<?> deleteTeacher(Long id) {
        return partyDocumentionervice.deleteDocument(id);
    }

    @DeleteMapping("/multiple")
    @ApiOperation("删除多条教师信息")
    public ResResult<?> deleteMultipleTeacherBase(Long[] ids) {
        return partyDocumentionervice.deleteMultipleDelete(ids);
    }

}
